package Book;

import java.util.Arrays;

public class Library {       // 图书存放
    private Book[] booklist = new Book[10];
    private int size;  //存的书的个数
    private int capacity;
    public  Library(){
        booklist[0] = new Book("三国演义","罗贯中",20.00,"小说");
        booklist[1] = new Book("西游记","吴承恩",20.00,"小说");
        booklist[2] = new Book("红楼梦","曹雪芹",20.00,"小说");
        size = 3;
        capacity = 10;
    }

    public int getCapacity() {
        return capacity;
    }

    public void enlargelist(){
        capacity += 10;
        this.booklist = Arrays.copyOf(this.booklist, capacity);

    }

    public Book getBook(int pos){
        return this.booklist[pos];
    }

    public void setBook(int pos, Book book){
       this.booklist[pos] = book;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }
}

